package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;

@Mapper
public interface UserMapper {
    @Select("select count(*) from user where create_time >= #{min} and create_time <= #{max}")
    Integer countByTime(LocalDateTime min, LocalDateTime max);


    @Select("select count(*) from user where create_time <= #{end}")
    Integer countTotal(LocalDateTime end);

    @Select("select * from user where openid = #{openId}")
    User selectByOpenId(String openId);

    void insert(User user);

    @Select("select * from user where id = #{userId}")
    User getUserById(Long userId);
}
